<template>

    <el-container>
        <el-aside width="15%" v-if="!dhlA">
            <!-- 导航栏 -->
            <el-row class="tac">
                <el-col>
                    <h5>欢迎来到xxx</h5>
                    <!-- 导航栏展开 主体-->
                    <!-- mode="horizontal" 属性可以使导航菜单变更为水平模式。class="el-menu-demo" -->
                    <el-menu  default-active="2" class="el-menu-vertical-demo" @open="handleOpen" @close="handleClose"
                        background-color="#545c64" text-color="#fff" active-text-color="#ffd04b">

                        <!--首页  -->
                        <el-menu-item index="4" @click="toPage('/')" class="router-link-exact-active">
                            <!-- 图标 -->
                            <i class="el-icon-setting"></i>
                            <span slot="title" class="router-link" style="color:pink;">首页</span>
                        </el-menu-item>

                        <!-- 导航1 -->
                        <el-submenu index="1">
                            <template slot="title">
                                <i class="el-icon-location"></i>
                                <span>用户表详情</span>
                            </template>

                            <el-menu-item-group>
                                <template slot="title">questioner</template>

                                <!-- 用户表 -->
                                <el-menu-item index="1-1" @click="toPage('/questionTable')" class="level2">提问者信息</el-menu-item>

                            </el-menu-item-group>

                            <!-- <el-menu-item-group title="分组2">
                                <el-menu-item index="1-3">选项3</el-menu-item>
                            </el-menu-item-group>
                            <el-submenu index="1-4">
                                <template slot="title">选项4</template>
                                <el-menu-item index="1-4-1">选项1</el-menu-item>
                            </el-submenu> -->
                        </el-submenu>


                        <el-submenu index="2">
                            <template slot="title">
                            <i class="el-icon-menu"></i>
                            <span slot="title">预约表</span>
                            </template>
                            <el-menu-item-group>

                                <template slot="title">submitTable</template>
                                <el-menu-item index="2-1" @click="toPage('/submitData')" class="level2">已提交的订单</el-menu-item>
                            
                            </el-menu-item-group>
                        </el-submenu>


                        <!-- page2 -->
                        <el-menu-item index="3" @click="toPage('/page2')">
                            <i class="el-icon-document"></i>
                            <router-link to="/page2" class="router-link">添加秒杀数据answerer</router-link>
                        </el-menu-item>

                        <!-- page3 -->
                        <el-menu-item index="5" @click="toPage('/page3')" class="router-link-exact-active">
                            <i class="el-icon-document"></i>
                            <router-link to="/page3" class="router-link">秒杀测试页面</router-link>
                        </el-menu-item>

                        <!-- 秒杀测试 -->
                        <!-- index  click  to 都要改一下 -->
                        <el-menu-item index="6" @click="toPage('/miaosha')" class="router-link-exact-active">
                            <i class="el-icon-document"></i>
                            <router-link to="/miaosha" class="router-link">秒杀页面！！</router-link>
                        </el-menu-item>
                    </el-menu>
                </el-col>

            </el-row>

        </el-aside>
        <el-container>


            
            <!-- 上面时导航栏，下面时头文件 -->
            <el-header>
                <myheader></myheader>
            </el-header>


            <!-- 横条 导航栏 -->
            <el-menu v-if="!dhlA" :default-active="activeIndex" class="el-menu-demo" mode="horizontal" @select="handleSelect">
                
                        <!--首页  -->
                        <el-menu-item index="4" @click="toPage('/')" class="router-link-exact-active">
                            <!-- 图标 -->
                            <i class="el-icon-setting"></i>
                            <span slot="title" class="router-link" style="color:pink;">首页</span>
                        </el-menu-item>

                        <!-- 导航1 -->
                        <el-submenu index="1">
                            <template slot="title">
                                <i class="el-icon-location"></i>
                                <span>用户表详情</span>
                            </template>

                            <el-menu-item-group>
                                <template slot="title">questioner</template>

                                <!-- 用户表 -->
                                <el-menu-item index="1-1" @click="toPage('/questionTable')" class="level2">提问者信息</el-menu-item>

                            </el-menu-item-group>

                            <!-- <el-menu-item-group title="分组2">
                                <el-menu-item index="1-3">选项3</el-menu-item>
                            </el-menu-item-group>
                            <el-submenu index="1-4">
                                <template slot="title">选项4</template>
                                <el-menu-item index="1-4-1">选项1</el-menu-item>
                            </el-submenu> -->
                        </el-submenu>


                        <el-submenu index="2">
                            <template slot="title">
                            <i class="el-icon-menu"></i>
                            <span slot="title">预约表</span>
                            </template>
                            <el-menu-item-group>

                                <template slot="title">submitTable</template>
                                <el-menu-item index="2-1" @click="toPage('/submitData')" class="level2">已提交的订单</el-menu-item>
                            
                            </el-menu-item-group>
                        </el-submenu>


                        <!-- page2 -->
                        <el-menu-item index="3" @click="toPage('/page2')">
                            <i class="el-icon-document"></i>
                            <router-link to="/page2" class="router-link">添加秒杀数据answerer</router-link>
                        </el-menu-item>

                        <!-- page3 -->
                        <el-menu-item index="5" @click="toPage('/page3')" class="router-link-exact-active">
                            <i class="el-icon-document"></i>
                            <router-link to="/page3" class="router-link">秒杀测试页面</router-link>
                        </el-menu-item>

                        <!-- 秒杀测试 -->
                        <!-- index  click  to 都要改一下 -->
                        <el-menu-item index="6" @click="toPage('/miaosha')" class="router-link-exact-active">
                            <i class="el-icon-document"></i>
                            <router-link to="/miaosha" class="router-link">秒杀页面！！</router-link>
                        </el-menu-item> </el-menu>
            <!-- 主体 -->
            <el-main>
                <router-view>

                </router-view>
            </el-main>

        </el-container>
    </el-container>
</template>
<script>

    import myheader from './myheader'


    export default {
        name: "myMain",
        data() {
            return {
                list1: {
                    list1_1: ""
                }
            }
        },
        components: {
            myheader
        },
        methods: {
            handleOpen() { },
            handleClose() { },

            // 下面都是标签页跳转
            toPage(src) {
                this.$router.push({
                    path: src,
                })
            },
            showIndex(index) {
                alert(index)
            }
        },
        computed:{
            dhlA(){
               return this.$store.getters.isAnswerer
            }
        },
        mounted() {
            // console.log(this.$store.state.miaosha.userData.commit("gggg","ggg"))
            this.$store.state.faq = "faq"
            // console.log(this.$store.state)
            // console.log(this.$store)
            // this.$cookies.config(60 * 60 * 24 * 30,'');
            // this.$cookies.set("user_session","25j_7Sl6xDq2Kc3ym0fmrSSk2xV2XkUkX")
            // alert(this.$cookies.get("user_session"))


                this.$cookies.config(60 * 60 * 24 ,'');
                this.$cookies.set("user_session","25j_7Sl6xDq2Kc3ym0fmrSSk2xV2XkUkX")
                this.$cookies.set("authority","游客")
                this.$cookies.set("username","hehe")
                this.$cookies.set("id","666")
                // console.log("cookies authority:",this.$cookies.get("authority"))
        },


    }
    // Window.loaclStorage.setItem("username",JSON.stringify("admin"))
    // localStorage.setItem("id", "666")
    // localStorage.setItem("authority", "游客")


              
                
</script>
<style scoped>
    .router-link {
        color: white;
        text-decoration: none
    }
    .level2{
        font-size:6px ;
        padding-left: 20%;
    }
    .el-menu-item,.el-submenu{
        text-align:left;
    }
</style>